﻿using Dapper;
using System.Data.SqlClient;
using yunbo.Model.BIP;

namespace yunbo.Repositorys.FPMRepositorys
{
    public class Mbd_BOMRepository
    {
        public string data = "Data Source=121.37.93.71;Initial Catalog=FanXingMES;User ID=sa;Password=geili@2025;";

        //查询所有未删除的BOM
        public List<Mbd_BOM> GetMbd_BOM()
        {
            using (SqlConnection connection = new SqlConnection(data))
            {
                string sql = "SELECT bom.bom_id,bom.bom_code,bom.bom_name,bom.bom_bb,bom.bom_fl,cp.cp_code,cp.cp_name,cp.cp_fl,cp.cp_xh,cp.cp_lx,bom.bom_mr,bom.bom_state FROM bd_cp as cp INNER JOIN  mbd_bom as bom ON bom.bom_code = cp.bom_code  where bom.is_deleted=1";
                List<Mbd_BOM> mbd_BOMs = connection.Query<Mbd_BOM>(sql).ToList(); // 使用 ToList() 获取所有菜单  
                return mbd_BOMs;
            }
        }
    }
}
